<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
		<title></title>
		<script type="text/javascript" src="script/config.js"></script>
		<style>
			* {
				margin: 0;
				padding: 0;
			}
			body{
      	background-color:white;
      }
			.box {
				height: 100%;
				width: 100%;
				background-color: white;
			}

			.top {
				height: 50px;
				width: 100%;
				margin-top: 80px;
				text-align: center;
				font: 20px "微软雅黑";
				color: rgb(17,64,108);
			}

			.center {
				height: 230px;
				width: 100%;
				text-align: center;
			}

			.center2 {
				height: 32px;
				margin-top: 40px;
				/*line-height: 50px;*/
				text-align: center;
				width: 70%;
				color: #f16c3c;
				margin-left:15%;
				border-bottom:1px solid #f16c3c;
			}
			/*.center2 img{
				width:30px;
				height:30px;
				vertical-align:top;
				float:left;
			}*/
			.name_a{
				height:25px;
				vertical-align:center;
				float:left;
				margin-left:15px;
				margin-right:5px;
			}
			.mobile_a{
				height:30px;
				vertical-align:top;
				float:left;
				margin-left:20px;
				margin-right:8px;
			}
			.idcard_a{
				height:25px;
				vertical-align:top;
				float:left;
				margin-left:5px;
			}
			 ::-webkit-input-placeholder {
				/* WebKit browsers */
				color: rgb(138, 171, 202);
				font-size:18px;
			}
			.center2 input{
				height:32px;
				width:75%;
				border:none;
				list-style: none;
				outline-style: none;
				border: none;
				background: none;
				display: inline-block;
				float: left;
				margin-left: 10px;
				font-size:18px;
			}
			.foot{
				width:64%;
				margin-left:18%;
				height:44px;
				background-color:#f16c3c;
				line-height:44px;
				text-align: center;
				color:white;
				font-size:20px;
				border-radius: 10px;
			}
			input {
				-webkit-tap-highlight-color:transparent;
			}
			.foot_all{
				width:75%;
				margin:0 auto;
				height:44px;
			}
			.foot_all>*{
				float:left;
				width:40%;
				margin-left:5%;
				margin-right:5%;
				height:44px;
				text-align:center;
				background-color:#f16c3c;
				border-radius:10px;
				line-height:44px;
				color:white;
			}
		</style>
	</head>
	<body>
		<div class="box">
			<div class="top">第2步:请填写您的个人信息</div>
			<div class="center">
				<div class="center2">
					<img src="image/name.png" class="name_a"><input type="text" class="center2_1" placeholder="姓名" id="name">
				</div>
				<!-- <div class="center2">
					<img src="image/mobile.png" class="mobile_a"><input type="text" class="center2_1" placeholder="手机号" id="tel">
				</div> -->
				<div class="center2">
					<img src="image/identity_card.png" class="idcard_a"><input type="text" class="center2_1" placeholder="身份证号" id="idcard">
				</div>
			</div>
			<!-- <div class="foot" id="foot">下一步</div> -->
			<div class="foot_all">
          <div class="foot_up" onclick="api.closeWin();">上一步</div>
					<div class="foot_down" id="foot">下一步</div>
			</div>
		</div>
	</body>
	<script type="text/javascript" src="script/jquery-3.2.1.min.js"></script>
	<script type="text/javascript" src="script/local.js"></script>
	<script type="text/javascript" src="script/APICloud-rest.js"></script>
	<script type="text/javascript" src="script/api.js"></script>
	<script>
	apiready = function(){
		// setTimeout("api.closeWin({name:'fiveregister1'})",600);
		$api.val($api.dom('#name'),'');
		$api.val($api.dom('#idcard'),'');
  var lorryid=api.pageParam.lorryid;
	$api.addEvt($api.dom('#foot'), 'click', function(){
						var name=$api.val($api.dom('#name'));
						// var mobile=$api.val($api.dom('#tel'));
						var idcard=$api.val($api.dom('#idcard'));
										if(name.length==0||(/(^\s+)|(\s+$)/g).test(name)){
											api.toast({
												 msg: '姓名不能为空或带有空格',
												 duration: 1000,
												location: 'middle'
											});

										}else if(idcard.length==0){
											api.toast({
												 msg: '身份证不为空',
												 duration: 1000,
												location: 'middle'
											});
										}else if(!(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(idcard))){
												api.toast({
													 msg: '身份证格式有误',
													 duration: 1000,
													location: 'middle'
												});
										}else{
											$api.post(url+'app.php/addlorry1',{
														body:{name:name,
															    lorryid:lorryid,
																	idcard:idcard,}
													 },function(ret){
														if(ret.result==0){
															api.toast({
																 msg: "提交成功",
																 duration: 1000,
																location: 'middle'
															});
															// api.openFrame({
															//   url: './firstregister2.html?lorryid='+ret.lorryid,
															//  });
															 api.openWin({
																 name: 'threeregister3',
																 url:  './threeregister3.html',
																 slidBackEnabled:false,
																 pageParam: {
																 lorryid: ret.lorryid
																}
															 });

														 }else{
															 alert(ret.desc);
														 }
													 });
												 }
												 })
						}
	</script>
</html>
